package com.cloudlead.common.worker.desc.datatype;

import java.util.List;

import com.cloudlead.common.worker.validator.Validator;
import com.cloudlead.common.lang.DictData;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"name", "javaType"})
public class FormData implements Cloneable {
    protected String name;

    protected String label;

    protected String desc;

    @JsonProperty("enum")
    protected List<? extends DictData> dict;

    protected String dictGroup;

    protected TypeDesc javaType;

    protected Boolean required;

    protected List<Validator> validators;

    protected String format;

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public TypeDesc getJavaType() {
        return javaType;
    }

    public void setJavaType(TypeDesc javaType) {
        this.javaType = javaType;
    }

    public List<? extends DictData> getDict() {
        return dict;
    }

    public void setDict(List<? extends DictData> dict) {
        this.dict = dict;
    }

    public String getDictGroup() {
        return dictGroup;
    }

    public void setDictGroup(String dictGroup) {
        this.dictGroup = dictGroup;
    }

    public Boolean getRequired() {
        return required;
    }

    public Boolean isRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public List<Validator> getValidators() {
        return validators;
    }

    public void setValidators(List<Validator> validators) {
        this.validators = validators;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        if (null == this) {
            return null;
        }
        return super.clone();
    }
}
